package com.mjh.zhujianju.enums;

/**
 * @author 刘洋
 * @Description: 政策类型枚举
 * @date 2018/8/11 14:24
 */
public enum PolicyEnum {
//    TYPE_ALL("0","全部"),
    TYPE_DECIDE("1","决定"),
    TYPE_ULLETIN("2","通报"),
    TYPE_OPINION("3","意见"),
    TYPE_OTHER("4","其他");


    private String code;
    private String name;

    PolicyEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static PolicyEnum[] getEnums(){
        return PolicyEnum.values();
    }

    public static String getName(String code){
        if(code == null){
            return null;
        }

        for (PolicyEnum policyEnum : PolicyEnum.values()){
            if(code.equals(policyEnum.getCode())){
                return policyEnum.getName();
            }
        }

        return null;
    }
}
